package com.k.util.excel.demo;

import com.k.util.excel.ExcelUtils;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class StudentEoTest {
    public static void main(String[] args) throws IOException {
        StudentEo s1 = new StudentEo("张三", 22);
        StudentEo s2 = new StudentEo("李四2", 23);

        List<StudentEo> studentList = new ArrayList<>();
        studentList.add(s1);
        studentList.add(s2);

        // export excel data
//        Workbook workbook = ExcelUtils.createWorkbook(StudentEo.class, studentList);
//        workbook.write(new FileOutputStream("e:/test/t1021.xlsx"));

        // export excel template
        Workbook workbookTpl = ExcelUtils.createWorkbook(StudentEo.class, null);
        workbookTpl.write(new FileOutputStream("e:/test/t1021_tpl.xlsx"));
    }
}
